/**
 * 您的公司.com
 * Copyright (c) 2018-2018 All Rights Reserved.
 */
package com.mei.demo;

import java.util.Arrays;
import java.util.Random;

/**
 * 
 *
 * @author mei.xiaoliang@qq.com
 */
public class RandomNum {

    public static void main(String[] args) {

        for (int i = 0; i < 100; i++)
            getRandomArray();

    }

    /**
     * 
     */
    private static void getRandomArray() {
        int[] array = new int[5];
        Random random = new Random();
        for (int i = 0; i < 5; i++) {
            int num = random.nextInt(5);
            if (num != 0) {
                array[i] = num++;
            }
        }
        Arrays.sort(array);
        System.out.println(Arrays.toString(array));
    }

}
